//
//  NormalTableViewCell.m
//  MMLOOK
//
//  Created by dllo on 15/8/25.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "NormalTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface NormalTableViewCell ()

@property (nonatomic, retain) UIImageView *showImage;
@property (nonatomic, retain) UILabel *titleLabel;

@end

@implementation NormalTableViewCell

- (void)dealloc
{
    [_titleLabel release];
    [_showImage release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self initionalSubview];
    }
    return self;
}

- (void)initionalSubview
{
    self.showImage = [[UIImageView alloc] init];
    self.showImage.layer.cornerRadius = 10;
    self.showImage.layer.masksToBounds = YES;
    [self.contentView addSubview:self.showImage];
    [_showImage release];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.backgroundColor = [UIColor colorWithWhite:0  alpha:0.5];
    self.titleLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.titleLabel];
    [_titleLabel release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.showImage.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 10);
    self.titleLabel.frame = CGRectMake(self.showImage.frame.origin.x, self.showImage.frame.size.height * 5 / 6 + self.showImage.frame.origin.y, self.showImage.frame.size.width, self.showImage.frame.size.height / 6);
}

-(void)sendarray: (NSMutableDictionary *)dic
{
    [self.showImage sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"cover_image_url"]]placeholderImage:[UIImage imageNamed:@"home.jpg"]];
    self.titleLabel.text = [NSString stringWithFormat:@"  %@", [dic objectForKey:@"title"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
